package org.project.s.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.project.pojo.Appoiment;
import org.project.service.user.ImgsService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
@Controller
@RequestMapping("/otherfun1")
public class Otherfun1controller {
	@Resource
	private    ImgsService  imgsService;
	
	@RequestMapping("/selectagreement1")
	public String selectagreement1(){
		HttpServletRequest req = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
		Appoiment appoiment=imgsService.selectxieyi();
		req.setAttribute("appoiment", appoiment);
		
		return "showxieyi";
	}
	
	
	
	@RequestMapping("/selectnotice1")
	public String selectnotice1(){
		HttpServletRequest req = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
		Appoiment appoiment=imgsService.selectxuzhi();
		req.setAttribute("appoiment", appoiment);
		return "showxuzhi";
	}
	
	
	@RequestMapping("/editxieyi")
	public String editagreement1(){
		HttpServletRequest req = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
		String agreement=req.getParameter("xieyi");
		System.out.println(agreement);
		Appoiment appoiment=new Appoiment();
		appoiment.setAgreement(agreement);
		int i=imgsService.editagreement1(appoiment);
		if(i>0){
		return "mainfra";
		}else{
		return "mainfra";	
		}
	}
	
	@RequestMapping("/editxuzhi")
	public String editnotice1(){
		HttpServletRequest req = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
		String notice=req.getParameter("xuzhi");
		System.out.println(notice);
		Appoiment appoiment=new Appoiment();
		appoiment.setNotice(notice);
		
		int i=imgsService.editnotice1(appoiment);
		if(i>0){
		return "mainfra";
	}else{
		return "mainfra";
	}
	}
	
	
	
	@RequestMapping("/selectagreement33")
	public String selectagreement33(){
		HttpServletRequest req = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
		Appoiment appoiment=imgsService.selectxieyi();
		req.setAttribute("appoiment", appoiment);
	//	System.out.println(appoiment.getAgreement());
		return "editxieyi";
	}
	
	
	
	@RequestMapping("/selectnotice33")
	public String selectnotice33(){
		HttpServletRequest req = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
		Appoiment appoiment=imgsService.selectxuzhi();
		req.setAttribute("appoiment", appoiment);
	//	System.out.println(appoiment.getNotice());
		return "editxuzhi";
	}
	
	
}
